package com.example.ruiji.controller;

import com.example.ruiji.common.Result;
import com.example.ruiji.entity.User;
import com.example.ruiji.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/sendMsg")
    public Result<String> sendMsg(@RequestBody User user) {
        return userService.sendMsg(user);
    }

    @PostMapping("/login")
    public Result<User> login(@RequestBody Map<String, String> map) {
        return userService.login(map);
    }
}
